package com.grm.task.manager.controller;

import com.grm.task.manager.common.Result;
import com.grm.task.manager.entity.Task;
import com.grm.task.manager.service.TaskService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RequestMapping("/task")
@RestController
public class TaskController {
    @Autowired
    private TaskService taskService;
    @PostMapping("/submit")
    public Result submitTasks(@RequestBody List<Task> tasks){
        return taskService.addTasks(tasks);
    }

    @PostMapping("/jumpQueue")
    public Result jumpQueue(@RequestBody Task task){
        return taskService.jumpQueue(task);
    }
}
